home *** CD-ROM | disk | FTP | other *** search
Wrap
/* ** $VER: Ripple.ieb 1.11, IE Arexx script ** Image Engineer Batch Processing script ** Copyright © by Patrik M Nydensten ** 2/2 1997 Stockholm/Sweden ** ** Ripple image. */ options results signal on error parse arg input command input = upper(strip(input)) address 'IMAGEENGINEER' select /* Required batch script commands */ when input = 'INFO' then return get_info() when input = 'CONFIG' then return get_config(command) when input = 'PROCESS' then return process_image(command) otherwise do 'REQUEST' '"Failure in call to batch script!"' '" Quit "' return '<ERROR>' end end exit 0 /* Required "Get_info" procedure ------------------------------------ */ /* S = SECONDARY, A = ALPHA, 1 = Single file, 2 = Multiple files */ get_info: back = 'OK' return back /* Required "Get_config" procedure ---------------------------------- */ get_config: parse arg '"'command'"' Xoff=128 ; Yoff=128 ; Amplitude=32 ; Period=32 ; Phase=0 ; Radius=128 if command ~= '' then parse var command Xoff Yoff Amplitude Period Phase '#'RipType '#'CalcType '#'LimitRip Radius 'IE_TO_FRONT' form = 'FORM "Bulge" " OK | Cancel "', ' INTEGER,"X offset",0,4096,'Xoff',SLIDER', ' INTEGER,"Y offset",0,4096,'Yoff',SLIDER', ' INTEGER,"Wave amplitude",0,359,'Amplitude',SLIDER', ' INTEGER,"Period",0,4096,'Period',SLIDER', ' INTEGER,"Phase",0,3600,'Phase',SLIDER' if command = '' then form = form||' CYCLE,"Ripple spread:","Around center|Out from center",0', ' CHECKBOX,"Use attenuated (radius limited) ripple?",0' form = form||' INTEGER,"Wave radius",0,4096,'Radius',SLIDER' if command = '' then do form = form||' CYCLE,"Type:","Best|Fast",0' form parse var result ok Xoff Yoff Amplitude Period Phase RipType LimitRip Radius CalcType . if ok = 0 then return '<ERROR>' if CalcType=0 then CalcType='BEST' else CalcType = 'FAST' end else do form parse var result ok Xoff Yoff Amplitude Period Phase Radius . if ok = 0 then return '<ERROR>' RipType = 'none' CalcType = 'none' LimitRip = 'none' end back = Xoff Yoff Amplitude Period Phase '#'RipType '#'CalcType '#'LimitRip Radius return back /* Required "Process_image" procedure ------------------------------- */ process_image: parse arg '"'src_image'"' '"'dst_image'"' '"'options'"' parse var options Xoff Yoff Amplitude Period Phase '#'RipType '#'CalcType '#'LimitRip Radius . 'OPEN' '"'src_image'"' '24' if (RC ~= 0) then do 'IE_TO_FRONT' 'REQUEST' '"Failed to load image:' d2c(10)||src_image'"' '" OK "' return '<ERROR>' end else LoadImage = result 'PROJECT_INFO' LoadImage 'WIDTH' /* Get width of image */ IW = RESULT 'PROJECT_INFO' LoadImage 'HEIGHT' /* Get height of image */ IH = RESULT if Xoff >= (IW-1) then Xoff = (IW-1) if Yoff >= (IH-1) then Yoff = (IH-1) if Period > max(IW,IH) then Period = max(IW,IH) if Radius > max(IW,IH) then Radius = max(IW,IH) do until ((Phase < 360)&(Phase >= 0)) if Phase > 359 then Phase = Phase - 360 if Phase < 0 then Phase = Phase + 360 end if LimitRip ~= 1 then Radius = '' if RipType = 0 then RipType = 'AROUND' else RipType = 'OUT' 'RIPPLE' LoadImage Xoff Yoff Amplitude Period Phase RipType CalcType Radius OutputImage = result 'CLOSE' LoadImage if getclip('cfg_save_frmt')='' then setclip('cfg_save_frmt','ILBM CmpByteRun1') 'SAVE_DATA' OutputImage '"'dst_image'"' '"'getclip('cfg_save_frmt')'"' if (RC ~= 0) then do 'IE_TO_FRONT' 'REQUEST' '"Failed to save image:' d2c(10)||dst_image'"' '" OK "' return '<ERROR>' end 'CLOSE' OutputImage back = 'OK' return back /* Internal procedures ---------------------------------------------- */ /*******************************************************************/ /* This is where control goes when an error code is returned by IE */ /* It puts up a message saying what happened and on which line */ /*******************************************************************/ error: if RC=5 then do IE_TO_FRONT LAST_ERROR 'REQUEST "'||RESULT||'"' end else do IE_TO_FRONT LAST_ERROR 'REQUEST "Error detected!!!'||D2C(10)||'Image Engineer error message is as follows'||D2C(10)||result||D2C(10)||'Script failed on line '||SIGL||'"' 'Doh!' end return '<ERROR>'